TARGET		= libxmlToShm.so
CC			= gcc

CFLAGS += -fPIC
CFLAGS += -DSYSDEF_PARSER_ON_HOST
CFLAGS += -DRDM_LATEST_SUPPORT
#Support for CMS phase 1 features
CFLAGS += -DCMS_XML_PARSE_PHASE_1

CFLAGS += -I$(CMS_BASE_DIR)/libmdm

LDFLAGS += 


####### Files

HEADERS = $(wildcard ./*.h)

SOURCES = $(wildcard ./*.c)

OBJECTS = $(patsubst %.c, %.o, $(SOURCES))

LZMAHEADERS = $(wildcard ./lzma/*.h)

LZMASOURCES = $(wildcard ./lzma/*.c)

LZMAOBJECTS = $(patsubst %.c, %.o, $(LZMASOURCES))


OBJS = $(OBJECTS) $(LZMAOBJECTS)


.NOTPARALLEL: all
all: $(TARGET)
	cp $(TARGET) $(XML_LIB_DIR)
	cp $(HEADERS) $(CMS_INC_DIR)
	cp $(LZMAHEADERS) $(XML_INC_DIR)
	@echo "###################################"
	@echo "#        $(TARGET)"
	@echo "#        Build up successfully"
	@echo "###################################"		
	
$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -shared $^ -o $@  $(LDFLAGS)

%.o:%.c
	@#printf "  CC      $(*).c\n"
	$(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@	

clean:
	@echo "###################################"
	@echo "#        clean $(TARGET) "
	@echo "###################################"		
	rm -f $(OBJECTS)
	rm -rf *.o *.d *.so
	rm -rf ./lzma/*.o ./lzma/*.d
